package com.jldx.common;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.jldx.oa.bean.OrderNo;

public class NoUtil {

	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
	
	public static String createNo(String key){
		String dateStr = sdf.format(new Date());
		OrderNo orderNo = OrderNo.dao.findById(key);
		Integer no = orderNo.getNo() + 1;
		orderNo.setNo(no);
		orderNo.update();
		String str = String.format("%5d", no).replace(" ", "0");  
		return orderNo.getPre() + dateStr+str;
	}
	
	
}
